package com.stu.controller;

import com.stu.pojo.Student;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Controller
public class StudentController {
    @RequestMapping("/student")
    public String toStudent(Model model){
        model.addAttribute("msg","Hello world");
        model.addAttribute("stu",new Student(1,"Bob"));
        model.addAttribute("today",new Date());
        List<Student> list = new ArrayList<Student>(){{
            add(new Student(1,"Bob"));
            add(new Student(2,"Tom"));
        }};
        model.addAttribute("students",list);
        model.addAttribute("role","admin");
        return "student";
    }
}
